/**
 * 整个项目api的管理
 *
 */

import request from "../utils/request"

// 使用封装好的axios向后端发起请求
export default {
    // MainHome组件
    getTableData(params) {
        return request({
            url: '/home/getMainHomeTableData',
            method: 'get',
            data: params,
            mock: true
        })
    },
    getCountData() {
        return request({
            url: '/home/getMainHomeCountData',
            method: 'get',
            mock: true
        })
    },
    getChartData() {
        return request({
            url: '/home/getMainHomeEchartData',
            method: 'get',
            mock: true
        })
    },

    //UserHome组件
    getUserData(params) {
        return request({
            url: '/user/getUser',
            method: 'get',
            mock: true,
            data: params
        })
    },
    addUser(params) {
        return request({
            url: '/user/add',
            method: 'post',
            // 这个mock如果是true的话 用的就是线上fastmock的数据
            mock: true,
            data: params
        })
    },
    editUser(params) {
        return request({
            url: '/user/edit',
            method: 'post',
            mock: true,
            data: params
        })
    },
    deleteUser(params) {
        return request({
            url: '/user/delete',
            method: 'post',
            mock: true,
            data: params
        })
    },
}